#include "timewidget.h"
#include "ui_timewidget.h"

TimeWidget::TimeWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::timeWidget)
{
    ui->setupUi(this);
    ui->lcdNumber->setNumDigits(8);
    ui->lcdNumber->setSegmentStyle(QLCDNumber::Flat);
    ui->lcdNumber->display(QTime::currentTime().toString("hh:mm:ss"));
    QTimer *timer = new QTimer(this);
    timer->start(1000);
    connect(timer,SIGNAL(timeout()),this,SLOT(timeChange()));
}

TimeWidget::~TimeWidget()
{
    delete ui;
}

void TimeWidget::changeEvent(QEvent *e)
{
    QWidget::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}
void TimeWidget::timeChange()
{
    ui ->lcdNumber->display(QTime::currentTime().toString("hh:mm:ss"));
}
